import React, {PureComponent} from 'react';
import './style.css'
import store from '../store'
import {NUMBER_TYPE} from "../constants/Constants";

class Left extends PureComponent {
    constructor(props) {
        super(props);
        this.state = {
            num: store.getState()[NUMBER_TYPE]
        }
    }

    componentDidMount() {
        store.subscribe(() => {
            this.setState({
                num: store.getState()[NUMBER_TYPE]
            })
        })
    }

    render() {
        const { num } = this.state;
        return (
            <div className='center'>
                <h1>Center</h1>
                <div className='content'>
                    <span>{num}</span>
                </div>
            </div>
        );
    }
}

Left.propTypes = {};

export default Left;